﻿<div class="top">
    <div class="w1200">
        <php>if(!empty($session_name)){</php>
            <div class="left">您好，&nbsp;<a style="font-size: 15px;color: red;"><php>echo session('name');</php></a>&nbsp;欢迎光临Let`s购！<a href="/Home/Index/loginout.html">[退出登录]</a></div>
            <div class="right"><a href="/Home/Personcenter/member.html">我的会员中心</a>|<a href="#">收藏夹</a>|<a href="#">服务中心</a>|<a href="#">在线客服</a>|<a href="/Home/Shopcar/shopcar.html" class="top_car">购物车<b>{$comnum}</b>件</a></div>
        <php>}else{</php>
          <div class="left">您好，欢迎光临Let`s购！<a href="/Home/Index/login.html">[登录]</a> <a href="/Home/Index/reg.html">[注册]</a></div>
          <div class="right"><a href="/Home/Index/login.html">我的会员中心</a>|<a href="/Home/Index/login.html">收藏夹</a>|<a href="/Home/Index/login.html">服务中心</a>|<a href="/Home/Index/login.html">在线客服</a>|<a href="/Home/Index/login.html">购物车<b>0</b>件</a></div>
        <php>}</php>
        
        <div class="clear"></div>
    </div>
</div>

<div class="head">
    <div class="w1200">
        <div class="logo"><a href="/Home/Index/index.html"></a></div>
        <div class="search">
            <form action="#" class="form">
                <input type="text" value="输入商品关键字" name="keyword" class="txt" onfocus="if(value=='输入商品关键字') {value=''}" onblur="if(value=='') {value='输入商品关键字'}"/>
                <input type="submit" value="搜索" class="sub"/>
            </form>
            <!-- <p><a href="#">iphone6s</a>|<a href="#">面膜</a>|<a href="#">婚庆床品</a>|<a href="#">运动鞋</a>|<a href="#">眼霜</a>|<a href="#">月饼</a>|<a href="#">智能手机</a>|<a href="#">连衣裙</a></p> -->
        </div>
        <div class="s_r">
            <dl>
                <dt>
                    <p class="shopcar_all" >购物车<span>{$comnum}</span></p>
                    <div class="com_car" style="">
                        <div class="line" ></div>
                        <div class="car_head" >最新添加的商品</div>
                        <hr>
                        <div class="commodity_list">
                            <php>if($comnum==0){</php>
                                <div>购物车中还没商品，赶紧选购吧！</div>
                            <php>}else{</php>
                                <div  style="overflow-y:scroll;width:98%;height: 150px;">
                                    <table style="width: 100%;overflow-y:scroll;text-align: center;overflow-y:scroll;" id="shop" >
                                        <tr style="height: 30px;border: 1px solid black;">
                                            <td>图片</td>
                                            <td style="text-align: center;">商品简介</td>
                                            <td>单价X数量</td>
                                            <td>总价</td>
                                            <td>删除</td>
                                        </tr>
                                        <php>$a=0;foreach($shopCar as $key => $value){</php>
                                            <tr class="shopcar-tr">
                                                <td class="shopcar-td">
                                                    <a ><img src="__PUBLIC__/upload/<?php echo $value['com_img_name']; ?>" class="shopcar-img"></a>
                                                </td>
                                                <td class="shopcar-name">
                                                    <a ><php> echo $value['com_name'].'　'.$value['com_discription'];</php></a>
                                                </td>
                                                <td><php> echo $value['com_price'].'X'.$value['com_num']; </php></td>
                                                <td><php> echo $value['com_price']*$value['com_num']; </php></td>
                                                <td><a href="/Home/Shopcar/delete?shopid=<?php echo $value['id']; ?>" class="delcar"><button  class="headdel" >删除</button></a></td>
                                            </tr>
                                        <php>$a=$a+$value['com_price']*$value['com_num'];}</php>
                                    </table>
                                </div>
                                
                                <div class="shop-foot">
                                    <span">总计：<php> echo $a; </php></span>
                                    <span style="float: right;"><button><a href="/Home/Shopcar/shopcar" class="go-shopcar" >去购物车</a></button></span>
                                </div>
                            <php>}</php>
                        </div>
                    </div>
                </dt>
                <dd>客服电话：<b>123-4567-891</b></dd>
            </dl>
        </div>
        <div class="clear"></div>
    </div>
</div>

<div class="menu">
    <div class="w1200">
        
        <div class="item"><a href="/Home/Index/index.html" class="home">商城首页</a></div>
        <div class="item"><a href="/Home/Product/product.html" class="timg">商品中心</a></div>
        <!-- 博客分类导航条 -->
        <div>
            <div class="left_nav"></div>
              <ul class="nav navbar-nav first_nav" id="nav">
                <?php foreach($cates as $cate){?>
                <!-- 顶级分类不显示 -->
                        <?php if(!empty($cate['child'])){?>
                            <ul id="third_nav">
                                <?php foreach ($cate['child'] as $child) {?>
                                    <li  class="item" id="third_content"><a href="/Home/Product/product.html?cateid=<?php echo $child['id']; ?>"><?php echo $child['cate_name']?></a>
                                        <?php if(!empty($child['child'])){?>
                                            <ul id="four_nav" style="display: none;">
                                                <?php foreach ($child['child'] as $childson) {?>
                                                    <li style=""><a href="/Home/Product/product.html?cateid=<?php echo $childson['id']; ?>"><?php echo $childson['cate_name']?></a>
                                                <?php }?>
                                            </ul>
                                        <?php } ?>
                                <?php } ?>
                            </ul>
                        <?php } ?>
                    <!-- </li> -->
                <?php }?>
              </ul>
            </div><!-- /.container-fluid -->
        </div>
        <!-- 博客分类导航条 -->
    </div>
</div>
<script type="text/javascript">
    $('#third_nav > li').on('mouseover',function(){
        $(this).find('#four_nav').show();
        $(this).find('#four_nav').css('background','#404145');
        $(this).find('#four_nav').css('color','#fff');
        $(this).find('#four_nav').css('position','absolute');
        $(this).css('position','relative');
    });
    $('#third_nav > li').on('mouseout',function(){
        $(this).find('#four_nav').hide();
    });

</script>
<!-- 购物车商品显示 -->
<script type="text/javascript">
    $(function(){
        $('.shopcar_all').hover(function(){
            $('.com_car').css('display','block');
        },function(){
            $('.com_car').css('display','none');
        });
        $('.com_car').hover(function(){
            $('.com_car').css('display','block');
        },function(){
            $('.com_car').css('display','none');
        });
        $('.delcar').on('click',function(){
            $(this).parent().parent().remove();
            $.get($(this).attr('href'),function(){});
            return false;
        });
    });
</script>